Point
Represents a point/vector in 2D or 3D
- Point.add(point1, point2)
-
Add the corresponding components of points.
- Point.addConstant(pointIn, constant)
-
Add a constant to each component.
- Point.arrangeOnGrid(points, purgeThreshold, distanceThreshold)
- Arguments:
points (
Point)purgeThreshold (
int)distanceThreshold (
float)
- Return type:
int
Sort 2D points on a grid. This task is related to checkerboard arrangement, but can be used together with other features than checkerboard corners. The only requirement for all points in the output index vector is that the points they reference are nodes in a common grid. The gx and gy indices are roughly aligned to the x- and y-axes. In case of severe distortion and/or a rotated grid it may be difficult to align both x and y axes over the whole image. In this case an attempt is made to align gx to the x-axis. This function adapts to non-linear drift over the grid of points and can be used to arrange extracted features non-calibration corrected images. For checkerboard detection, see the dedicated function Image.Calibration.Pattern.detectCheckerboard, which also includes corner extraction. The purgeThreshold input can be used to remove isolated points along the border of the found grid. If a grid is required to have at least 4 points along each side we can set this threshold to 4 and only keep the central part of the grid that fulfills this requirement. This effectively shrinks the detected grid.
- Point.clone(point)
-
Create an independent copy of this point. If the input is a vector of points, the output is a vector of points.
- Point.create(x, y, z)
- Arguments:
x (
float)y (
float)z (
float)
- Return type:
Create 2D or 3D point(s). The third z-coordinate input is optional, if omitted a 2D point is created, otherwise a 3D point. Vector input is allowed to create vectors of points. The input vectors must then all be of equal length.
The following input combinations are allowed: Two scalar floats give a 2D point (x,y) Three scalar floats give a 3D point (x,y,z) Two vectors of equal length give a vector of 2D points Three vectors of equal length give a vector of 3D points
- Point.cross(a, b)
-
Calculates the cross product of two point vectors (only 3D). The cross product is anti-commutative: a x b = -(b x a)
- Point.divide(point1, point2)
-
Divide the components of the first point with the corresponding components of the second point.
- Point.divideConstant(pointIn, constant)
-
Divide each component with a constant.
- Point.dot(point1, point2)
-
Calculates the dot product of two point vectors of the same dimensionality (e.g. x1*x2+y1*y2+z1*z2).
- Point.getDistance(point1, point2)
-
Compute the distance between the two points of the same dimensionality (2D or 3D).
- Point.getDistanceToLine(pointIn, line)
- Arguments:
pointIn (
Point)line (
const auto)
- Return type:
float
Calculates the distance from a point to a line (2D/3D).
- Point.getDistanceToPlane(pointIn, plane)
-
Calculates the distance from a point to a plane (only 3D).
- Point.getXY(point)
- Argument:
point (
Point)
- Return type:
float
Get the X and Y coordinates of a point.
- Point.getXYZ(point)
- Argument:
point (
Point)
- Return type:
float
Get the X, Y and Z coordinates of a point (only 3D).
- Point.isFinite(point)
- Argument:
point (
Point)
- Return type:
boolean
Check if a point is finite, i.e. none of the values is Inf/NaN.
- Point.isZero(point)
- Argument:
point (
Point)
- Return type:
boolean
Returns true if all coordinates are zero.
- Point.mean(point1, point2)
-
Calculate the mean position of the points. Can either be used for finding the midpoint of two Points or for finding the mean position of many points.
- Point.multiply(point1, point2)
-
Multiply the corresponding components of two points.
- Point.multiplyConstant(pointIn, constant)
-
Multiply each component with a constant.
- Point.negate(pointIn)
-
Returns the negated point vector (every component changes its sign).
- Point.norm(pointIn, type)
- Arguments:
pointIn (
Point)type (
enum)
- Return type:
float
Calculates different types of non-negative vector norms. If no enumeration is provided, the “L-2-Norm” will be calculated, which represents the magnitude or length of the point vector.
- Point.normalize(pointIn)
-
Returns the unit vector (length=1) with the same direction or nil if the input point vector has the length 0.
- Point.projectOntoPlane(pointIn, plane)
-
Projects one or multiple points onto a plane (only 3D).
- Point.setXY(point, x, y)
- Arguments:
point (
Point)x (
float)y (
float)
Set the X and Y coordinates of a point.
- Point.setXYZ(point, x, y, z)
- Arguments:
point (
Point)x (
float)y (
float)z (
float)
Set the X, Y and Z coordinates of a point (only 3D).
- Point.subtract(point1, point2)
-
Subtract the corresponding components of the second point from those of the first point.
- Point.subtractConstant(pointIn, constant)
-
Subtract a constant from each component.
- Point.toMatrix(point, storeInColumns)
-
Converts a point or a vector of points to a matrix.